<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<%@include file="../includes/header.jsp"%>

<h2 class="title">Your Portfolio</h2>
<p class="meta">Check everything you own, <s:property
	value="#session.user.firstname" /> <s:property
	value="#session.user.lastname" /></p>
<s:div cssClass="entry">
	<table class="portfolio">
		<thead>
			<tr>
				<th class="column1">You own</th>
				<th class="column2">Possible exchange rates</th>
				<th class="column3">Actions</th>
				<th class="column4">Equivalent (favorite currency)</th>
			</tr>
		</thead>
		<tbody>
			<s:sort comparator="ownedCurrencyComp" source="owned">
				<s:iterator status="s">
					<tr class="<s:if test="#s.even">even</s:if><s:else>odd</s:else>">
						<td><s:property value="currency.code" /> <s:property
							value="unitsFormatted" /></td>
						<td><s:iterator value="currency.toThisCurrency">
							<s:property value="currency1.code" /> at <s:property
								value="askReciprocalFormatted" />
							<br />
						</s:iterator> <s:iterator value="currency.fromThisCurrency">
							<s:property value="currency2.code" /> at <s:property
								value="bidFormatted" />
							<br />
						</s:iterator></td>
						<td><s:iterator value="currency.toThisCurrency">
							<s:url action="displayRateDetail" var="detail"
								includeParams="get">
								<s:param name="code1" value="%{currency1.code}" />
								<s:param name="code2" value="%{currency2.code}" />
							</s:url>
							<s:a href="%{detail}">
							View <s:property value="currency1.code" />/<s:property
									value="currency2.code" />
							</s:a>
							<br />
						</s:iterator> <s:iterator value="currency.fromThisCurrency">
							<s:url action="displayRateDetail" var="detail"
								includeParams="get">
								<s:param name="code1" value="%{currency1.code}" />
								<s:param name="code2" value="%{currency2.code}" />
							</s:url>
							<s:a href="%{detail}">
							View <s:property value="currency1.code" />/<s:property
									value="currency2.code" />
							</s:a>
							<br />
						</s:iterator></td>
						<td><s:if test="equivalent!=null">
							<s:property value="#session.user.favoriteCurrency.code" />
							<s:property value="equivalentFormatted" />
						</s:if></td>
					</tr>
				</s:iterator>
			</s:sort>
		</tbody>
	</table>
</s:div>

<%@include file="../includes/footer.jsp"%>
